package com.zhouz.common.base.entity.dto;

/**
 * 接口统一返回
 * @Author 张鹏
 * @Date 2019-09-10 22:55
 */
public enum ResCode {

    TOKEN_VALID_ERROR(305, "TOKEN验证失败"),
    TOKEN_EXPIRE_ERROR(306, "TOKEN已过期"),
    AUTH_CAPTCHA_UNMATCH(307,"验证码已失效"),
    AUTH_CAPTCHA_ERROR(308,"验证码错误"),


    BAD_ARGUMENT(401, "参数不对"),
    BAD_ARGUMENT_VALUE(402, "参数值不对"),
    BAD_BUSY(405,"操作过于频繁"),
    BAD_VALIDATE(407,"验证不通过"),
    NO_MORE(410, "没有更多数据了"),

    UN_LOGIN(501, "请登录"),
    SERIOUS(502, "系统内部错误"),
    UN_SUPPORT(503, "业务不支持"),
    UPDATED_DATA_XPIRED(504, "更新数据已经失效"),
    UPDATED_DATA_FAILED(505, "更新数据失败"),
    UN_AUTHZ(506, "无操作权限"),
    NO_DEVIDEID(507,"没有deviceId"),

    REFRESH_TOKEN(600, "TOKEN已刷新，请用返回的TOKEN进行访问"),
    ;
    private Integer value;
    private String desc;

    private ResCode(Integer value, String desc){
        this.value = value;
        this.desc = desc;
    }

    public String desc() {
        return desc;
    }

    public Result result(){
        return Result.fail(this);
    }
    public Result result(Object obj){
        return Result.fail(this).data(obj);
    }

    public Integer value() {
        return value;
    }

}
